{include file="public/header" /}
<body>
<form class="layui-form" action="#">

    <div class="layui-form-item">
        <label class="layui-form-label">物流单号</label>
        <div class="layui-input-block">
            <input type="text" name="courier_num" required  lay-verify="required" placeholder="请输入订单号" autocomplete="off" class="layui-input" value="{$list.courier_num}">
            <input type="hidden" name="typeid" id='typeid' value="">
            <input type="hidden" name="id" id='id' value="">
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="remark" placeholder="请输入内容" class="layui-textarea">{$list.remark}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
</body>
{include file="public/footer" /}
<script>
    //提交
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                type: 'POST',
                url: "{:url('shipments')}",
                data: data.field,
                dataType: 'json',
                success: function(res){
                    if(res.status == 1){
                        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                        parent.layer.close(index);//关闭弹出的子页面窗口
                        parent.layer.msg(res.info,{icon:1,time:2000,shade: [0.3, '#000']});
                    }else{
                        layer.msg(res.info,{icon:2,time:2000,shade: [0.3, '#000']});
                    }
                },
                error:function(res) {
                    console.log(res.msg);
                },
            });
            return false;
        });
    });
</script>
